%% 0 gnuplot
GNUPLOT is a command-driven interactive function plotting program.
It is case sensitive (commands and function names written in lowercase
are not the same as those written in CAPS).  All command names may be
abbreviated, as long as the abbreviation is not ambiguous.
%% 1 save
This command saves either user-defined functions, variables, or both
to the specified file.

Syntax:	   save  {option} <filename>

Where <option> is either 'functions' or 'variables'.  If no option
is used GNUPLOT saves both functions and variables.

'save'd files are written in text format and may be read by the
'load' command.

The filename must be enclose in quotes.
%% 1 print
This command prints the value of <expression>.

Syntax:  print <expression>

See 'expressions'.
%% 1 plot
The 'plot' primary command of the program.  It displays functions
and data in many, many ways.  The full syntax of this command is:

  plot {ranges}	  <function> {style} {, <function> {style}...}

Where <function> is either a mathematical expression or the name of a
data file enclosed in quotes.  User-defined functions and variables may also
be defined here.

Curly braces {,} denote optional items.

A 'plot' command can be as simple as

   plot sin(x)

or as complex as (!)

   plot [t=1:100] [-pi:pi*2] tan(t), "data.1" with lines, besj0(t) with points
%% 2 style
Plots may be displayed in one of three styles:	'lines', 'points', or
'impulses'.  The 'lines' style connects adjacent points with lines.  The
'points' style displays a small symbol at each point.  The 'impulses' style
displays a vertical line from the X axis to each point.

Default styles are chosen with the 'set function style' and 'set data style'
commands.

Syntax:  with <style>

Where <style> is one of 'lines', 'points', or 'impulses'.  These keywords
may be abbreviated.

Examples:			       Displays:
plot sin(x) with impulses	       ; sin(x) with impulses
plot [-9:30]  sin(x) w points, cos(x)  ; sin(x) with points, cos(x) default
plot [] [-2:5] tan(x), "data.1" with l ; tan(x) default, "data.1" with lines
plot "leastsq.dat" w i		       ; "leastsq.dat" with impulses
%% 2 ranges
These two options specify the region of the plot which will be displayed.

Ranges may be provided on the 'plot' command line as synonyms for the
'set xrange' and 'set yrange' commands.

Syntax:  [{dummy-var =} {xmin : xmax}] { [{ymin : ymax}] }

Where dummy-var is the independent variable ('x' is used by default) and
the min and max terms can be expressions or constants.

Both the min and max terms are optional.  The ':' is also optional if
neither a min nor a max term is specified.  This allows '[]' to be used
as a null range specification.

Specifying a Y range turns autoscaling OFF.

Examples:

plot cos(x)				; use current ranges
plot [-10:30] sin(pi*x)/(pi*x)		; set xrange only
plot [t = -10 :30]  sin(pi*t)/(pi*t)	; same, but use t as dummy-var
plot [-pi:pi] [-3:3]  tan(x), 1/x	; set y and xranges
plot [] [-2:sin(5)*-8] sin(x)**besj0(x) ; set only yrange
plot [:200] [-pi:]  exp(sin(x))		; set xmax and ymin only
%% 2 data_file
Discrete data contained in a file can displayed by specifying the
name of the data file (enclosed in quotes) on the 'plot' command line.

Data files should contain one data point per line.  A data point may be
specified either as an X and Y value separated by blank space, or as
just the Y value, in which case the program will use the number of the
coordinate as the X value.  Coordinate numbers starts at 0 and are
incremented for each data point read.  Blank lines and lines beginning
with ! or # will be treated as comments and ignored.


This example compares the data in the file population.dat to a theoretical
curve:
	  pop(x) = 103*exp((1965-x)/10)
	  plot [1960:1990] 'population.dat', pop(x)

The file population.dat might contain:

! Gnu population in Antarctica since 1965
1965   103
1970   55
1975   34
1980   24
1985   10
%% 1 shell
The 'shell' command spawns an interactive shell.  To return to GNUPLOT,
type 'logout' if using VMS, 'exit' or your END-OF-FILE character if
using Unix, or 'exit' if using MS-DOS.

A single shell command may be spawned by preceding it with the ! character
at the beginning of a command line.  Control will return immediately to
GNUPLOT after this command is executed.  For example,

    ! dir

prints a directory listing and then returns to GNUPLOT.

$ is accepted as a synonym for ! in VMS.
%% 1 clear
This command erases the current screen or output device as specified by
'set output'.  This usually generates a formfeed on hardcopy devices.
Use 'set terminal' to set the device type.
%% 1 load
This command executes each line of the specified input file
as if it had been typed in interactively.  Files created by the 'save'
command can later be 'load'ed.	Any text file containing valid commands
can be created and then executed by the 'load' command.  Files being
'load'ed may themselves contain 'load' commands.

The 'load' command must be the last command on the line.

Syntax:	    load <input-file>

The name of the input file must be enclosed in quotes.
%% 1 exit
'exit', 'quit' and your computer's END-OF-FILE character will
exit GNUPLOT.  All these commands will clear the output device
(as the 'clear' command does) before exiting.
%% 1 quit
'quit' is a synonym for 'exit'.  See 'exit'.
%% 1 expressions
In general, any mathematical expression accepted by C, FORTRAN, Pascal, or
BASIC is valid.  The precedence of these operators is determined by the
specifications of the C programming language.  White space (spaces and tabs)
is ignored inside expressions.

Complex constants may be expressed as the {real,imag}, where <real> and
<imag> must be numerical constants.  For example {3,2} represents 3 + 2i;
{0,1} represents 'i' itself.
%% 2 functions
The functions in GNUPLOT are the same as the corresponding functions
in the UNIX math library, except that all functions accept integer, real,
and complex arguments, unless otherwise noted.	The BASIC sgn() function
is also supported.
%% 3 real
This function returns the real part of its argument.
%% 3 imag
This function returns the imaginary part of its argument as a real number.
%% 3 arg
This function returns the phase of a complex number, in radians.
%% 3 sin
This function returns the sine of its argument.  'sin' expects its argument
to be in radians.
%% 3 cos
This function returns the cosine of its argument.  'cos' expects its argument
to be in radians.
%% 3 tan
This function returns the tangent of its argument.  'tan' expects its argument
to be in radians.
%% 3 asin
This function returns the arc sin (inverse sin) of its argument.  'asin'
returns its argument in radians.
%% 3 acos
This function returns the arc cosine (inverse cosine) of its argument.	'acos'
returns its argument in radians.
%% 3 atan
This function returns the arc tangent (inverse tangent) of its argument.
'atan' returns its argument in radians.
%% 3 sinh
This function returns the hyperbolic sine of its argument.  'sinh' expects
its argument to be in radians.
%% 3 cosh
This function returns the hyperbolic cosine of its argument.  'cosh' expects
its argument to be in radians.
%% 3 tanh
This function returns the hyperbolic tangent of its argument.  'tanh' expects
its argument to be in radians.
%% 3 int
This function returns the integer part of its argument, truncated toward
zero.
%% 3 abs
This function returns the absolute value of its argument.
The returned value is of the same type as the argument.

For complex arguments, abs(x) is defined as the length of x in the
complex plane [i.e.  sqrt(real(arg)**2 + imag(arg)**2) ].
%% 3 sgn
This function returns 1 if its argument is positive, -1 if its
argument is negative, and 0 if its argument is 0.  If the argument
is a complex value, the imaginary component is ignored.
%% 3 sqrt
This function returns the square root of its argument.
%% 3 exp
This function returns the exponential function of its argument (e raised to
the power of its argument).
%% 3 log
This function returns the natural logarithm (base e) of its argument.
%% 3 log10
This function returns the logarithm (base 10) of its argument.
%% 3 besj0
This function returns the j0th Bessel function of its argument.  'besj0'
expects its argument to be in radians.
%% 3 besj1
This function returns the j1st Bessel function of its argument.  'besj1'
expects its argument to be in radians.
%% 3 besy0
This function returns the y0th Bessel function of its argument.  'besy0'
expects its argument to be in radians.
%% 3 besy1
This function returns the y1st Bessel function of its argument.  'besy1'
expects its argument to be in radians.
%% 3 floor
This function returns the smallest integer not greater than its argument.
For complex numbers, 'floor' returns the smallest integer not greater than
the real part of its argument.
%% 3 ceil
This function returns the largest integer not less than its argument.
For complex numbers, 'ceil' returns the largest integer not less than
the real part of its argument.
%% 2 operators
The operators in GNUPLOT are the same as the corresponding operators
in the C programming language, except that all operators accept integer, real,
and complex arguments, unless otherwise noted.	The FORTRAN **
(exponentiation) operator is also supported.

Parentheses may be used to change order of evaluation.
%% 3 binary
The following is a list of all the binary operators and their usage:

Symbol	    Example	Explantion
**	    a**b	exponentiation
*	    a*b		multiplication
/	    a/b		division
%	    a%b		modulo
+	    a+b		addition
-	    a-b		subtraction
==	    a==b	equality
!=	    a!=b	inequality
&	    a&b		bitwise and
^	    a^b		bitwise exclusive or
|	    a|b		bitwise inclusive or
&&	    a&&b	logical and
||	    a||b	logical or
?:	    a?b:c	terniary operation

The terniary operator evaluates its first argument (a).  If it is true
(non-zero) the second argument (b) is returned, otherwise the
third argument (c) is returned.
%% 3 unary
The following is a list of all the unary operators and their usage:

Symbol	    Example	Explantion
-	    -a		unary minus
~	    ~a		one's complement
!	    !a		logical negation
%% 1 start_up
When GNUPLOT is run, it looks for an initialization file to execute.
This file is called '.gnuplot' on Unix systems, and 'GNUPLOT.INI' on
other systems.	If this file is not found in the current directory,
the program will look for it in your home directory (under MS-DOS,
the environment variable GNUPLOT should contain the name of this directory).

If this file is found, GNUPLOT executes the commands in this file.  This
is most useful for setting your terminal type and defining any functions or
variables which you use often.	The variable 'pi' is already defined for
you.
%% 1 user_defined
You may define your own functions and variables.  User-defined functions and
variables may be used anywhere.

User-defined function syntax:
    <function-name> ( <dummy-var> ) =  <expression>

Where <expression> is defined in terms of <dummy-var>.

User-defined variable syntax:
    <variable-name> = <constant-expression>

Examples:
    w = 2
	q = floor(tan(pi/2 - 0.1))
    f(x) = sin(w*x)
    sinc(x) = sin(pi*x)/(pi*x)
    delta(t) = (t == 0)
    ramp(t) = (t > 0) ? t : 0

The variable 'pi' is already defined for you.

See 'show functions' and 'show variables'.
%% 1 set-show
The 'set' command sets LOTS of options.

The 'show' command shows their settings.  'show all' shows all the settings.
%% 2 autoscale
If autoscaling is set, the Y axis is automatically scaled to fit the range
of the function or data being plotted.	If autoscaling is not set, the
current Y range is used.  See 'set yrange'.

Syntax:  set autoscale
	 set noautoscale
	 show autoscale
%% 2 output
By default, plots are displayed to the standard output.  The 'set output'
command redirects the displays to the specified file or device.

Syntax:  set output {filename}
	 show output

The filename must be enclosed in quotes.  If the filename is omitted, output
will be sent to the standard output.
%% 2 style
Plots may be displayed in one of three styles:	'lines', 'points', or
'impulses'.  The 'lines' style connects adjacent points with lines.  The
'points' style displays a small symbol at each point.  The 'impulses' style
displays a vertical line from the X axis to each point.

Default styles are chosen with the 'set function style' and 'set data style'
commands.

Syntax:  set function style <style>
	 set data style <style>
	 show function style
	 show data style

Where style is either 'lines', 'points', or 'impulses'.
%% 2 logscale
Log scaling may be set on the X and/or Y axis.

Syntax:  set logscale <axes>
	 set nologscale
	 show logscale

Where <axes> is either 'x', 'y', or 'xy'.
%% 2 variables
The 'show variables' command lists all user-defined variables and their
values.

Syntax:  show variables
%% 2 functions
The 'show functions' command lists all user-defined functions and their
definitions.

Syntax:  show functions
%% 2 samples
The sampling rates of functions may be changed by the 'set samples'
command.  By default, sampling is set to 160 points.  A higher sampling
rate will produce more accurate plots, but will take longer.  In generating
plots, GNUPLOT will use either the sampling rate set or the resolution of
the current output device, whichever is smaller.

Syntax:  set samples <expression>
	 show samples
%% 2 terminal
GNUPLOT supports many different graphics devices.  Use the 'set terminal'
command to select the type of device for which GNUPLOT will produce output.

Syntax:  set terminal {terminal-type}
	 show terminal

If <terminal-type> is omitted, the program will list the available terminal
types.	<terminal-type> may be abbreviated.

Use 'set output' to redirect this output to a file or device.
%% 2 zero
GNUPLOT will not display points when their imaginary parts are greater
than the 'zero' threshold.  The default 'zero' value is 1e-8.

Syntax:  set zero <expression>
	 show zero
%% 2 xrange
The 'set xrange' command sets the horizontal range of values which will
be displayed.

This range may also be specified on the 'plot' command line.

Syntax:  set xrange [{xmin : xmax}]

Where <xmin> and <xmax> terms are expressions or constants.

Both the <xmin> and <xmax> terms are optional.
%% 2 yrange
The 'set yrange' command sets the vertical range of values which will
be displayed.  This command turns autoscaling OFF.

This range may also be specified on the 'plot' command line.

Syntax:  set yrange [{ymin : ymax}]

Where <ymin> and <ymax> terms are expressions or constants.

Both the <ymin> and <ymax> terms are optional.
%% 1 help
The 'help' command will display on-line help.  To specify information
on a particular topic use the syntax:

    help <topic>

You may exit the help utility and return to the plot program
by either pressing <return> at the 'Topic?' prompt or pressing your
computer's END-OF-FILE character at any help prompt.
%% 1 substitution
Command-line substitution is specified by a system command encolsed in
backquotes (``).   This command is spawned and the output it produces
replaces the name of the command (and backquotes) on the command line.

Newlines in the output produced by the spawned command are replaced with
blanks.

Command-line substitution can be used anywhere on the GNUPLOT command line.



Examples:

a(x) = `leastsq`		  ; substitutes "`leastsq`" with output
		    produced by a program named leastsq.
a(x) = `run leastsq.exe`	  ; same but for VMS.
%%
